<template>
	<div class="login">
		login

		<button @click="login">login</button>
	</div>
</template>

<script setup lang="ts">
	const login = async () => {
		const { data } = await useFetch('/api/login?id=100', { method: 'POST', body: { name: 'zs', password: '123' } })

		const cookie = useCookie('token', {
			maxAge: 60,
		})

		cookie.value = data.value?.data.token as string

		return navigateTo('/')
	}

	/* const { data } = await useFetch('/api/homeInfo', { method: 'get' })
	console.log(data) */
</script>
